/*
 * @Author: biluo
 * @Date: 2021-04-08 15:49:36
 * @LastEditTime: 2021-04-08 17:01:10
 * @FilePath: \codee:\webNew\test\directive_vue\src\utils\utilJS\validatorFrom\validatorUtil\index.js
 */
const strategys  = {
	required(...args) {
		const [value,val,message] = args
		if(!value) {
			return message
		}
	},
	max(value, max, message) {
		if(value.toString().trim().length > max) {
			return message
		}
	},
	min(value, min, message) {
		if(value.toString().trim().length < min) {
			return message
		}
	},
	validator(value, callback, message) {
		// console.log(typeof callback,callback)
		if(typeof callback !== "function") {
			throw "validator must be function"
		}
		if(!callback(value)) {
			return message
		}
	}
}

export default strategys
// module.exports = strategys